﻿using System;
using System.Text;

namespace _916night1
{
    class Program
    {
   

        static void Main(string[] args)

        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

            /*double x, y;
            Char c;

            Console.WriteLine("请输入两个数字一个操作符：");
            x = Convert.ToDouble(Console.ReadLine());
            y = Convert.ToDouble(Console.ReadLine());
            c = Convert.ToChar(Console.ReadLine());

            switch (c) {
                case '-':
                    Console.WriteLine("两数相减得：{0}",(x-y)); break;
                case '+':
                    Console.WriteLine("两数相加得：{0}",(x+y)); break;
                case '*':
                    Console.WriteLine("两数相乘得:{0}",x*y); break;
                case '/':
                    if (y == 0)
                    {
                        Console.WriteLine("输0干什么");
                    }
                    else
                    {
                        Console.WriteLine("两数相除得：{0}", x / y);
                    }
                 ; break;

                  
            }
            */
            OddChange();

        }

       public static int OddChange()
        {
            decimal commodityPrice;
            decimal oddChange;
            decimal pay;

            Console.WriteLine("输入商品价格:");
            commodityPrice=Convert.ToDecimal(Console.ReadLine());
            Console.WriteLine("输入支付金额：");
            pay = Convert.ToDecimal(Console.ReadLine());

            oddChange = pay - commodityPrice;

            if (oddChange<0)
            {
                Console.WriteLine("没钱买什么东西");
                return 0;
            }

            Console.WriteLine($"共找零：{oddChange}");

            if (oddChange>100) {
                Console.WriteLine($"找补100块:{(int)oddChange/100}张");
                oddChange = oddChange - (int)oddChange / 100 * 100;
               
            }

            if (oddChange > 50 )
            {
                Console.WriteLine($"找补50块:{(int)oddChange / 50}张");
                oddChange = oddChange - (int)oddChange / 50 * 50;
            }

            if (oddChange >10 )
            {
                Console.WriteLine($"找补10块:{(int)oddChange / 10}张");
                oddChange = oddChange - (int)oddChange / 10 * 10;             
            }

            if (oddChange >5)
            {
                Console.WriteLine($"找补5块:{(int)oddChange / 5}张");
                oddChange = oddChange - (int)oddChange / 5 * 5;
            }

            if (oddChange >1)
            {
                Console.WriteLine($"找补1块:{(int)oddChange / 1}张");
                oddChange = oddChange - (int)oddChange / 1 * 1;
            }

            if ((double)oddChange>0.5)
            {
                Console.WriteLine($"找补0.5块:{(int)((double)oddChange / 0.5)}张");
                oddChange = oddChange - (decimal)((int)(((double)oddChange )/ 0.5)*0.5);
            }

            if ((double)oddChange>=0.1)
            {
                Console.WriteLine($"找补0.1块:{(int)(oddChange *10 /1)}张");

            }
            return 0;
        }
    }
}


